from .base import BaseModel, db
from datetime import datetime

class DecryptionLog(BaseModel):
    __tablename__ = 'decryption_logs'
    action = db.Column(db.String(100), nullable=False)
    details = db.Column(db.Text)
    user_id = db.Column(db.String(36), db.ForeignKey('users.id'), nullable=False)
    created_at = db.Column(db.DateTime, default=datetime.utcnow)
    
    # 关联用户
    user = db.relationship('User', backref=db.backref('decryption_logs', lazy=True))